﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="MvcMembership.Controllers" %>
<asp:Content ID="content" ContentPlaceHolderID="MainContent" runat="server">
<% var users = (ViewData["Users"] as List<MembershipUser>); %>
<h2 class="MvcMembership" style="margin-bottom: 20px;">Membership Administration</h2>

<fieldset class="MvcMembership">
	<legend>Users</legend>

	<% if( users != null && users.Count > 0 ){ %>
	<p>All of the application's users are listed below. <% =Html.ActionLink( "Click here to create a new user.", "CreateUser" ) %></p>
	<ol>
		<% foreach( var user in users ){ %>
		<li><% =Html.ActionLink<MembershipAdministrationController>( x => x.UserDetails( (Guid)user.ProviderUserKey ), user.UserName ) %></li>
		<% } %>
	</ol>
	<% }else{ %>
	<p>No users have been entered into the system yet. <% =Html.ActionLink( "Create a new user.", "CreateUser" ) %></p>
	<% } %>

</fieldset>

<fieldset class="MvcMembership">
	<legend>Roles</legend>

	<% if( (ViewData["Roles"] as List<string>).Count > 0 ){ %>
	<ul>
	<% foreach( string role in (ViewData["Roles"] as List<string>) ){ %>
		<li><% =Html.ActionLink<MembershipAdministrationController>( x=> x.Role(role), role ) %> (<% =Html.ActionLink<MembershipAdministrationController>( x=> x.DeleteRole(role), "Delete" ) %>)</li>
	<% } %>
	</ul>
	<% }else{ %>
	<div>No roles have been added to the system yet.</div>
	<% } %>

</fieldset>

<% using( Html.Form( "MembershipAdministration", "CreateRole" ) ){ %>
<fieldset class="MvcMembership">
	<legend>Create Role</legend>

	<div>
	<label for="role">Role</label>
	<% =Html.TextBox( "role", new { size = 32, maxlength = 32}) %>
	</div>

	<div><% =Html.SubmitButton( "submitAddRole", "Add Role" ) %></div>

</fieldset>
<% } %>


</asp:Content>